import 路径转换注解.An1;

import java.lang.annotation.Annotation;

/**
 * @Author: WangYongGan
 * @Date: 2021/11/11 14:43
 * @Description:
 */
public class Test2 {
    public static void main(String[] args) {
        Student2 student2=new Student2();
        Annotation[] declaredAnnotations = student2.getClass().getAnnotations();
        System.out.println(declaredAnnotations.length);
        for (Annotation declaredAnnotation : declaredAnnotations) {
            if(declaredAnnotation instanceof An1){
                An1 an1=(An1) declaredAnnotation;
                System.out.println(an1.name());
            }
        }
    }
}
